import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/Home.vue'),
    redirect: '/home/home_main',
    children: [
      {
        path: 'home_main',
        name: 'home_main',
        component: () => import('../views/Home_main.vue'),
      },
      {
        path: 'personalcenter',
        name: 'personalcenter',
        component: () => import('../views/Personalcenter.vue'),
        children: [
          {
            path: '/',
            redirect: 'todo'
          },
          {
            path: 'todo',
            name: 'todo',
            component: () => import('../views/Percenter_todo.vue'),
            children: [
              {
                path: '/',
                redirect: 'todo'
              },
              {
                path: 'done',
                name: 'done',
                component: () => import('../components/Todo_done.vue'),
              },
              {
                path: 'todo',
                name: 'todo',
                component: () => import('../components/Todo_todo.vue'),
              },
            ]
          },
          {
            path: 'myapply',
            name: 'myapply',
            component: () => import('../views/Percenter_myapply.vue'),
            children: [
              {
                path: '/',
                redirect: 'todo'
              },
              {
                path: 'done',
                name: 'done',
                component: () => import('../components/Myapply_done.vue'),
              },
              {
                path: 'todo',
                name: 'todo',
                component: () => import('../components/Myapply_todo.vue'),
              },
            ]
          },
          {
            path: 'check',
            name: 'check',
            component: () => import('../views/Percenter_check.vue')
          },
          {
            path: 'clockin',
            name: 'clockin',
            component: () => import('../views/Percenter_clockin.vue')
          },
          {
            path: 'mymeeting',
            name: 'mymeeting',
            component: () => import('../views/Percenter_mymeeting.vue')
          },
          {
            path: 'myperformance',
            name: 'myperformance',
            component: () => import('../views/Percenter_myperformance.vue')
          },
          {
            path: 'mynews',
            name: 'mynews',
            component: () => import('../views/Percenter_mynews.vue'),
            // children: [
            //   {
            //     path: '/',
            //     redirect: 'all'
            //   },
            //   {
            //     path: 'all',
            //     name: 'all',
            //     component: () => import('../components/Mynews_all.vue'),
            //   },
            // ]
          },
          {
            path: 'myprofile',
            name: 'myprofile',
            component: () => import('../views/Percenter_myprofile.vue')
          },
        ]
      },
      {
        path: 'meetmanagement',
        name: 'meetmanagement',
        component: () => import('../views/Meetmanagement.vue'),
        children: [
          {
            path: '/',
            redirect: 'management'
          },
          {
            path: 'management',
            name: 'management',
            component: () => import('../views/Meet_management.vue')
          },
          {
            path: 'category',
            name: 'category',
            component: () => import('../views/Meet_category.vue')
          },
          {
            path: 'resources',
            name: 'resources',
            component: () => import('../views/Meet_resources.vue')
          },
        ]
      },
      {
        path: 'atten',
        name: 'atten',
        component: () => import('../views/Atten.vue'),
        children: [
          {
            path: '/',
            redirect: 'approval'
          },
          {
            path: 'approval',
            name: 'approval',
            component: () => import('../views/Atten_ Approval.vue')
          },
          {
            path: 'query',
            name: 'query',
            component: () => import('../views/Atten_query.vue')
          },
          {
            path: 'set',
            name: 'set',
            component: () => import('../views/Atten_Set.vue')
          },
          {
            path: 'analysis',
            name: 'analysis',
            component: () => import('../views/Atten_analysis.vue')
          },
        ]
      },
      {
        path: 'information',
        name: 'information',
        component: () => import('../views/Information.vue'),
        children: [
          {
            path: '/',
            redirect: 'administration'
          },
          {
            path: 'administration',
            name: 'administration',
            component: () => import('../views/Information_Administration.vue')
          },
          {
            path: 'notice',
            name: 'notice',
            component: () => import('../views/Information_Notice.vue')
          },
        ]
      },
      {
        path: 'achievements',
        name: 'achievements',
        component: () => import('../views/Achievements.vue'),
        children: [
          {
            path: '/',
            redirect: 'examine'
          },
          {
            path: 'examine',
            name: 'examine',
            component: () => import('../views/Achievements_Examine.vue')
          },
          {
            path: 'set',
            name: 'set',
            component: () => import('../views/Achievements_Set.vue')
          },
        ]
      },
      {
        path: 'addressbook',
        name: 'addressbook',
        component: () => import('../views/Addressbook.vue'),
        children: [
          {
            path: '/',
            redirect: 'personal'
          },
          {
            path: 'personal',
            name: 'personal',
            component: () => import('../views/Addressbook_personal.vue')
          },
          {
            path: 'personal_group',
            name: 'personal_group',
            component: () => import('../views/Addressbook_personal_group.vue')
          },
          {
            path: 'corporate',
            name: 'corporate',
            component: () => import('../views/Addressbook_corporate.vue')
          },
          {
            path: 'public',
            name: 'public',
            component: () => import('../views/Addressbook_public.vue')
          },
          {
            path: 'public_group',
            name: 'public_group',
            component: () => import('../views/Addressbook_public_group.vue')
          },
        ]
      },
      {
        path: 'staffAdmin',
        name: 'staffAdmin',
        component: () => import('../views/StaffAdmin.vue'),
        children: [
          {
            path: '/',
            redirect: 'organization'
          },
          {
            path: 'organization',
            name: 'organization',
            component: () => import('../views/StaffAdmin_Organization.vue')
          },
          {
            path: 'project',
            name: 'project',
            component: () => import('../views/StaffAdmin_Project.vue')
          },
          {
            path: 'abandon',
            name: 'abandon',
            component: () => import('../views/StaffAdmin_Abandon.vue')
          },
          {
            path: 'postAdmin',
            name: 'postAdmin',
            component: () => import('../views/StaffAdmin_PostAdmin.vue')
          },
          {
            path: 'employeeList',
            name: 'employeeList',
            component: () => import('../views/StaffAdmin_EmployeeList.vue')
          },
        ]
      },
      {
        path: 'system',
        name: 'system',
        component: () => import('../views/System.vue'),
        children: [
          {
            path: '/',
            redirect: 'roleConfiguration'
          },
          {
            path: 'roleConfiguration',
            name: 'roleConfiguration',
            component: () => import('../views/System_RoleConfiguration.vue')
          },
          {
            path: 'accessConfiguration',
            name: 'accessConfiguration',
            component: () => import('../views/System_AccessConfiguration.vue')
          },
          {
            path: 'approvalProcess',
            name: 'approvalProcess',
            component: () => import('../views/System_ApprovalProcess.vue')
          },
          {
            path: 'loginLogs',
            name: 'loginLogs',
            component: () => import('../views/System_LoginLogs.vue')
          },
          {
            path: 'operationLogs',
            name: 'operationLogs',
            component: () => import('../views/System_OperationLogs.vue')
          },
        ]
      },
      {
        path: 'clock',
        name: 'clock',
        component: () => import('../views/Process_clock.vue'),
      },
      {
        path: 'meeting',
        name: 'meeting',
        component: () => import('../views/Process_meeting.vue'),
      },
      {
        path: 'leave',
        name: 'leave',
        component: () => import('../views/Process_leave.vue'),
      },
      {
        path: 'performance',
        name: 'performance',
        component: () => import('../views/Process_performance.vue'),
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
